﻿using System;
using System.ServiceModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnterpriseServices.DalEf;

namespace EnterpriseServices.Service
{

    public interface IValidationManagerBase
    {

        /// <summary>
        /// Returns true if the user exists.
        /// </summary>
        /// <param name="userName">The username.</param>
        /// <returns></returns>
        bool DoesUserExist(string userName);

        /// <summary>
        /// Returns true if the user exists.
        /// </summary>
        /// <param name="userName">The username.</param>
        /// <returns></returns>
        bool DoesUserExistPass(string userName, string password);

        /// <summary>
        /// Returns true if a user belongs to the requested role.
        /// A user belongs to a role if
        /// <list type="bullet">
        /// 		<item>the user is directly attached to a role</item>
        /// 		<item>the groups the user belongs to are attached to a role</item>
        /// 		<item>the groups' child groups are attached to a role</item>
        /// 		<item>the associated groups the user belongs to are attached to a role</item>
        /// 	</list>
        /// Regarding Groups, a user only belongs to a role if he is eiher a group owner or a group member.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="roleName">Name of the role.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        bool IsUserInRole(string applicationName, string roleName, string userName);

        /// <summary>
        /// Returns true if a user belongs to the requested role.
        /// A user belongs to a role if
        /// <list type="bullet">
        /// 		<item>the user is directly attached to a role</item>
        /// 		<item>the groups the user belongs to are attached to a role</item>
        /// 		<item>the groups' child groups are attached to a role</item>
        /// 		<item>the associated groups the user belongs to are attached to a role</item>
        /// 	</list>
        /// Regarding Groups, a user only belongs to a role if he is eiher a group owner or a group member.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="roleName">Name of the role.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        bool IsUserInRolePass(string applicationName, string roleName, string userName, string password);

        /// <summary>
        /// Determines whether [is group in role] [the specified application name].
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="roleName">Name of the role.</param>
        /// <param name="GroupName">Name of the group.</param>
        /// <returns>
        /// 	<c>true</c> if [is group in role] [the specified application name]; otherwise, <c>false</c>.
        /// </returns>
        bool IsGroupInRole(string applicationName, string roleName, string groupName);
        
        /// <summary>
        /// Gets the name of the users by application.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <returns></returns>
        List<User> GetUsersByApplicationName(string applicationName);
    }
}
